package com.swyc.osschat.Test.designMode.combination.base;

/**
 * @description 抽象根节点(菜单组件)
 * @Author: z156940l@outlook.com
 * @className MenuComponent
 * @Date: 2022/7/21 17:33
 */
public abstract class MenuComponent {
    //菜单名
    protected String name;
    //菜单层级
    protected int level;

    //添加子菜单
    public void add(MenuComponent menuComponent){
        throw new UnsupportedOperationException();
    }

    //移除子菜单
    public void remove(MenuComponent menuComponent){
        throw new UnsupportedOperationException();
    }

    //获取指定的子菜单
    public MenuComponent getChild(int index){
        throw new UnsupportedOperationException();
    }

    //获取菜单名称
    public String getName(){
        return name;
    }

    //打印菜单名称(子菜单或菜单项)
    public abstract void print();
}
